#include "DATSURFFactory.h"

DATObject* DATSURFFactory::createDATObject(IplImage* inImage)
{
	DATObject* lNewDATObjectSURF = new DATObjectSURF;
	lNewDATObjectSURF->mLastSeenObject = inImage;
	return lNewDATObjectSURF;
}

DATFrame* DATSURFFactory::createDATFrame(IplImage* inImage,int inFramePos)
{
	//Does not take control of the frame... should not copy it !
	if(inImage)
	{
		if(inImage->nChannels>1)
		{
			IplImage* lTempImage=NULL;
			if(inImage->roi)
			{
				lTempImage = cvCreateImage(cvSize(inImage->roi->width,inImage->roi->height),inImage->depth,1); //GRAY !
			}
			else
			{
				lTempImage = cvCreateImage(cvSize(inImage->width,inImage->height),inImage->depth,1); //GRAY !
			}
			cvCvtColor(inImage,lTempImage,CV_BGR2GRAY);
			//cvReleaseImage(&inImage);
			inImage = lTempImage;
		}
	}
	DATFrame* lNewDATFrameSURF = new DATFrameSURF(inImage,inFramePos); 
	return lNewDATFrameSURF;
}
